<?php
class Contactinfo_model extends Model{

	var $_alertmsg = '';
	
    function Contactinfo_model(){
        parent::Model();       
    }
    function getdetail(){
    	$detail->contactemail = '';
    	$detail->contactinfo  = '';
    	$detail->alertmsg = $this->_alertmsg;
    	$query = $this->db->get('siteinfo');
    	if($query->num_rows){
    		$detail->contactemail = $query->row()->contactemail;
	    	$detail->contactinfo = get_content('siteinfo',$query->row()->id)->contactinfo;
    	}
    	return $detail;
    }
    function save(){
    	if(FALSE!==$this->input->post('hidden_status')){
    		$query = $this->db->get('siteinfo');
    		if($query->num_rows){
    			$this->db->where('id',$query->row()->id);
    			$this->db->update('siteinfo',array('contactemail'=>$this->input->post('txt_contactemail')));
    			set_content('siteinfo',$query->row()->id,array('contactinfo'=>$this->input->post('txt_contactinfo')));
    		}
    		else{
    			$this->db->insert('siteinfo',array('contactemail'=>$this->input->post('txt_contactemail')));
    			set_content('siteinfo',$this->db->insert_id(),array('contactinfo'=>$this->input->post('txt_contactinfo')));
    		}
    		$this->_alertmsg = lang('contactinfo_msg_savesuccessfull');
    	}
    }
}

/* End of file yourprofile_model.php */
/* Location: ./system/application/admin/controllers/yourprofile_model.php */